<%@ page pageEncoding="utf-8" contentType="text/html; charset=utf-8"%> 
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd style="text-align:center"">
<html>
<head>
<title>活动模板管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<script type="text/javascript" src="/admin/js/act_template.js"/>
<style type="text/css">
</style>
<script type="text/javascript">

</script>
</head>
<body>
<jsp:include page="_head.jsp"></jsp:include>
<div>
    <c:if test="${info.tid != '0'}">
	<table id="info-tb" class="table table-bordered" style="background:#EEE">
        <thread>
            <td style="text-align:left">ID</td>
            <td>标题</td>
            <td>活动时间</td>
            <td>性别</td>
            <td>等级</td>
            <td>OPT &nbsp;&nbsp; <c:if test="${info.tid=='0'}"> <a href="javascript:add('info')">配置基本信息</a></c:if></td>
        </thread>
	    <tr>
	        <td>${info.tid}</td>
	        <td>${info.title}</td>
	        <td>${info.begin_date} ~ ${info.end_date}</td>
	        <td><c:if test="${info.gender==2}">不限</c:if><c:if test="${info.gender==1}">男</c:if><c:if test="${info.gender==0}">女</c:if></td>
	        <td>${info.min_level} ~ ${info.max_level}</td>
	        <td style="width:160px"><c:if test="${info.tid != '0'}"><a href="javascript:add('info')">修改</a></c:if></td>
	    </tr>
	    <tr>
	        <td colspan="6">介绍:　${info.intro}</td>
	    </tr>
	</table>
	</c:if>
    <div id="info-div" <c:if test="${info.tid != '0'}">style="display:none"</c:if>>
        <form id="form1" name="form1" method="post" action="/admin/act/tmpl/add/info.do" style="padding:0 0 10px 0">
            <input name="tid" id="tid" value="${info.tid}" type="hidden"/>
            <table class="table table-bordered">
                <tr height="30px">
                    <td style="width:150px; text-align:right">标题: &nbsp;&nbsp;</td>
                    <td><input style="width:390px" name="title" id="title" value="${info.title}" type="text"/></td>
                </tr>
                <tr>
                    <td style=" text-align:right">时间: &nbsp;&nbsp;</td>
                    <td>
                        <div class="datepicker input-append">
                            <input data-format="yyyy-MM-dd hh:mm:ss" name="beginDate" id="beginDate"  type="text" value="${info.begin_date}"  style="width:150px"></input>
                            <span class="add-on">
                                <i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
                            </span>
                        </div> 到
                        <div class="datepicker input-append">
                            <input data-format="yyyy-MM-dd hh:mm:ss" type="text" name="endDate" id="endDate" value="${info.end_date}"  style="width:150px"></input>
                            <span class="add-on">
                                <i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
                            </span>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td style="text-align:right">说明: &nbsp;&nbsp;</td>
                    <td><textarea name="intro" rows="3" cols="200" >${info.intro}</textarea></td>
                </tr>
                <tr>
                    <td style="text-align:right">详细链接: &nbsp;&nbsp;</td>
                    <td><input name="intro_link" value="${info.intro_link}" type="text"  style="width:390px"/></td>
                </tr>
            </table>

            <!--table width="80%"><tr><td style="width:60px;">用户属性</td><td><hr/></td></tr></table-->
            <table class="table table-bordered">
                <tr height="30px">
                    <td style="width:150px; text-align:right">性别: &nbsp;&nbsp;</td>
                    <td>
                        <input type="radio" name="gender" value="2" <c:if test="${info.gender==2}">checked</c:if>/> 不限 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <input type="radio" name="gender" value="1" <c:if test="${info.gender==1}">checked</c:if> /> 男 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <input type="radio" name="gender" value="0" <c:if test="${info.gender==0}">checked</c:if>/> 女
                    </td>
                </tr>
                <tr>
                    <td style="text-align:right">等级区间: &nbsp;&nbsp;</td>
                    <td>
                        <input name="min_level" value="${info.min_level}" type="text" style="width:100px"/> ~
                        <input name="max_level"  value="${info.max_level}" type="text" style="width:100px"/>
                    </td>
                </tr>
            </table>
            <input type="submit" name="button1" id="button1" value="保存" class="btn" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <a href="javascript:add('info')">取消</a>
        </form>
    </div>
</div>
<c:if test="${info.tid != '0'}">
<div>
	<table class="table table-bordered" style="background:#EEE">
        <thread>
            <tr>
            <td style="text-align:center;" colspan="3">碎片</td>
            <td style="text-align:center;" colspan="4">奖励</td>
            </tr>
            <tr>
            <td>名称</td>
            <td>获得代号</td>
            <td>获得时弹窗</td>
            <td>兑换周期</td>
            <td>兑换量</td>
            <td>兑换的奖励</td>
            <td>个人获得奖励上限</td>
            <td>全局获得奖励上限</td>
            <td>OPT <c:if test="${info.tid!='0'}">&nbsp;<a href="javascript:add('reward')">增加奖励</a></c:if></td>
            </tr>
        </thread>
        <tbody>
            <c:forEach var="r" items="${rs}">
            <tr>
                <td>${r.sp_name}</td>
                <td>${r.sp_code}</td>
                <td><c:if test="${r.sp_alert=='0'}">不弹窗</c:if><c:if test="${r.sp_alert=='1'}">弹窗</c:if></td>
                <td>
                    <c:if test="${r.rw_cycle=='LESS'}">不限</c:if>
                    <c:if test="${r.rw_cycle=='DATE'}">每日</c:if>
                    <c:if test="${r.rw_cycle=='WEEK'}">每周</c:if>
                    <c:if test="${r.rw_cycle=='TOTAL'}">合计</c:if>
                </td>
                <td>${r.rw_sp_num}</td>
                <td>
                    <c:if test="${r.rw_type=='HONOR'}">称号:
                        <c:forEach var="h" items="${honors}">
                            <c:if test="${h.id==r.rw_type_info}">${h.name}</c:if>
                        </c:forEach>
                    </c:if>
                    <c:if test="${r.rw_type=='SILVER'}">分贝: ${r.rw_type_info}</c:if>
                    <c:if test="${r.rw_type=='EXP'}">经验: ${r.rw_type_info}</c:if>
                    <c:if test="${r.rw_type=='ITEM'}">服饰: ${r.rw_type_info}</c:if>
                </td>
                <td>${r.rw_user_limit}</td>
                <td>${r.rw_all_limit}</td>
	            <td style="width:160px"><a href="javascript:edit_reward(${r.rid})">修改</a></td>
            </tr>
            </c:forEach>
        </tbody>
	</table>
    <div id="reward-div" style="display:none">
        <!--table width="80%"><tr><td style="width:60px;">奖励</td><td><hr/></td></tr></table-->
        <form id="form1" name="form1" method="post" action="/admin/act/tmpl/add/reward.do" style="padding:0 0 10px 0">
            <input name="tid" id="tid" value="${info.tid}" type="hidden"/>
            <input name="rid" id="rid" value="0" type="hidden"/>
            <table class="table table-bordered">
                <thread>
                    <tr>
                    <td style="text-align:center;" colspan="3">碎片</td>
                    <td style="text-align:center;" colspan="4">奖励</td>
                    </tr>
                    <tr>
                    <td>名称</td>
                    <td>获得代号</td>
                    <td>获得时弹窗</td>
                    <td>兑换周期</td>
                    <td>兑换量</td>
                    <td>兑换的奖励</td>
                    <td>个人获得奖励上限</td>
                    <td>全局获得奖励上限</td>
                    </tr>
                </thread>
                <tbody>
                    <tr>
                        <td style="width:100px">
                            <input type="text" id="sp_name" name="sp_name" style="width:60px"/>
                        </td>
                        <td>
                            <input type="text" id="sp_code" name="sp_code" style="width:60px"/>
                        </td>
                        <td>
                            <select id="sp_alert" name="sp_alert" style="width:80px">
                                <option value="0">不弹窗</option>
                                <option value="1">弹窗</option>
                            </select>
                        </td>
                        <td>
                            <select id="rw_cycle" name="rw_cycle" style="width:80px">
                                <option value="LESS">不限</option>
                                <option value="DATE">每日</option>
                                <option value="WEEK">每周</option>
                                <option value="TOTAL">合计</option>
                            </select>
                        </td>
                        <td>
                            <input type="text" id="rw_sp_num" name="rw_sp_num" style="width:60px" value="0"/>
                        </td>
                        <td style="width:230px">
                            <select id="rw_type" name="rw_type" onchange="javascript:rw_type_change('rw_type');" style="width:80px">
                                <option value="HONOR">称号</option>
                                <option value="SILVER">分贝</option>
                                <option value="EXP">经验</option>
                                <option value="ITEM">服饰</option>
                            </select>
                            <select id="rw_type_honor" style="width:100px" onchange="javascript:rw_honor_change('rw_type_honor');">
                                <option value="0">......</option>
                                <c:forEach var="h" items="${honors}">
                                    <option value="${h.id}">${h.name}</option>
                                </c:forEach>
                            </select>
                            <input type="text" id="rw_type_info" name="rw_type_info" value="0" placeholder="多个以,间隔" style="width:130px"/>
                        </td>
                        <td>
                            <input type="text" id="rw_user_limit" name="rw_user_limit" value="1" style="width:60px"/>
                        </td>
                        <td>
                            <input type="text" id="rw_all_limit" name="rw_all_limit" value="0" style="width:60px"/>
                        </td>
                    </tr>
                </tbody>
            </table>
                <input type="submit" name="button2" id="button2" value="保存奖励" class="btn" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <a href="javascript:add('reward')">取消</a>
        </form>
    </div>
</div>
<div>
	<table id="task-info-tb" class="table table-bordered" style="background:#EEE">
        <thread>
            <td style="text-align:left">类型</td>
                <td>行为对象</td>
                <td>区间</td>
                <td>区间</td>
                <td>个人日碎片上限</td>
                <td>奖励信息(代号,数量,几率(千分之)#代号...)</td>
                <td style="width:160px">OPT &nbsp; <c:if test="${info.tid!='0'}"><a href="javascript:add('task')">增加行为</a></c:if></td>
        </thread>
        <c:forEach var="t" items="${ts}">
        <tr>
            <td>
                <c:if test="${t.ttype=='KB_GIFT'}">Ｋ币送礼</c:if>
                <c:if test="${t.ttype=='KB_SPENT'}">Ｋ币消费</c:if>
                <c:if test="${t.ttype=='FB_GIFT'}">分贝送礼</c:if>
                <c:if test="${t.ttype=='FB_SPENT'}">分贝消费</c:if>
                <c:if test="${t.ttype=='UP_LEVEL'}">等级提升</c:if>
                <c:if test="${t.ttype=='REC_PRAISE'}">收到点赞</c:if>
                <c:if test="${t.ttype=='UP_MIKE'}">有效上麦</c:if>
                <c:if test="${t.ttype=='MARRIAGE'}">结婚</c:if>
                <c:if test="${t.ttype=='OPEN_ROOM'}">开房</c:if>
                <c:if test="${t.ttype=='LOGIN'}">登录</c:if>
            </td>
            <td>
            <c:if test="${t.ttype=='KB_GIFT'}">
                <c:forEach var="h" items="${kb_gifts}">
                    <c:if test="${h.id==t.obj_id}">${h.name}</c:if>
                </c:forEach>
            </c:if>
            <c:if test="${t.ttype=='FB_GIFT'}">
                <c:forEach var="h" items="${fb_gifts}">
                    <c:if test="${h.id==t.obj_id}">${h.name}</c:if>
                </c:forEach>
            </c:if>
            </td>
            <td>${t.min_num}</td>
            <td>${t.max_num}</td>
            <td>${t.max_day}</td>
            <td>${t.reward_info}</td>
            <td style="width:160px"><a href="javascript:edit_task(${t.task_id})">修改</a></td>
        </tr>
        </c:forEach>
	</table>

    <div id="task-div" style="display:none">
        <form id="form1" name="form1" method="post" action="/admin/act/tmpl/add/task.do" style="padding:0 0 10px 0">
            <input name="tid" id="tid" value="${info.tid}" type="hidden"/>
            <input name="task_id" id="task_id" value="0" type="hidden"/>
            <!--table width="80%"><tr><td style="width:60px;">行为</td><td><hr/></td></tr></table-->
            <table class="table table-bordered">
                <thread>
                    <td style="text-align:left">类型</td>
                    <td>行为对象</td>
                    <td>区间</td>
                    <td>区间</td>
                    <td>个人日碎片上限</td>
                    <td>奖励信息</td>
                </thread>
                <tbody id="task_tb" >
                    <tr>
                        <td style="width:125px">
                            <select id="ttype" name="ttype" style="width:100px" onchange="javascript:ttype_change('ttype');">
                                <option value="KB_GIFT">Ｋ币送礼</option>
                                <option value="KB_SPENT">Ｋ币消费</option>
                                <option value="FB_GIFT">分贝送礼</option>
                                <option value="FB_SPENT">分贝消费</option>
                                <option value="UP_LEVEL">等级提升</option>
                                <option value="REC_PRAISE">收到点赞</option>
                                <option value="UP_MIKE">有效上麦</option>
                                <option value="MARRIAGE">结婚</option>
                                <option value="OPEN_ROOM">开房</option>
                                <option value="LOGIN">登录</option>
                            </select>
                        </td>
                        <td>
                            <select id="kb_gift" style="width:100px" onchange="javascript:gift_change('kb_gift');">
                                <option value="0">......</option>
                                <c:forEach var="h" items="${kb_gifts}">
                                    <option value="${h.id}">${h.name}</option>
                                </c:forEach>
                            </select>
                            <select id="fb_gift" style="width:100px" onchange="javascript:gift_change('fb_gift');">
                                <option value="0">......</option>
                                <c:forEach var="h" items="${fb_gifts}">
                                    <option value="${h.id}">${h.name}</option>
                                </c:forEach>
                            </select>
                            <input type="hidden" id="obj_id" name="obj_id" value="0" style="width:60px"/>
                        </td>
                        <td>
                            <input type="text" id="min_num" name="min_num" value="0" style="width:60px"/>
                        </td>
                        <td>
                            <input type="text" id="max_num" name="max_num" value="0" style="width:60px"/>
                        </td>
                        <td>
                            <input type="text" id="max_day" name="max_day" value="1" style="width:60px"/>
                        </td>
                        <td>
                            <input type="text" id="reward_info" name="reward_info" placeholder="代号,数量,几率(千分之)#代号..." style="width:260px"/>
                        </td>
                    </tr>
                </tbody>
            </table>
            <input type="submit" name="buttont" id="buttont" value="保存行为" class="btn" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <a href="javascript:add('task')">取消</a>
        </form>
    </div>

</div>
</c:if>
</body>
</html>
